package com.sxhuayuan.parking.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * 车牌 用户与车牌 一对多的关系 一个用户可以有多个车牌
 */
@Entity
@Table(name = "hypk_member_car_plate", uniqueConstraints = { @UniqueConstraint(columnNames = { "car_plate", "member_id" }) })
public class MemberCarPlate extends BaseEntity {

	private static final long serialVersionUID = -2950600633293501868L;

	private String carPlate;

	/** 是否默认 */
	private Boolean isDef = false;

	private Member member;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "member_id")
	@JsonIgnore
	public Member getMember() {
		return member;
	}

	public void setMember(Member member) {
		this.member = member;
	}

	@Column(length = 32, name = "car_plate")
	public String getCarPlate() {
		return carPlate;
	}

	public void setCarPlate(String carPlate) {
		this.carPlate = carPlate;
	}

	@Column(nullable = false)
	public Boolean getIsDef() {
		return isDef;
	}

	public void setIsDef(Boolean isDef) {
		this.isDef = isDef;
	}

}
